enum Side;

ref struct Bar
{
	String ^Date;
	String ^Time;
	float Open;
	float Close;
	float High;
	float Low;
};

ref class Bars
{
public:
	Bars(String ^sym_name, Account ^acc); // Constructor
	Bar^ operator[](int Index);

	property String ^SymbolName { String ^get(){ return symbolName; } }
	property int Count { int get(){ return cur_bar; } }
	property Trigger ^Trg { Trigger ^get(){ return trigger; } }
	property float MostHigh { float get(){ return mostHigh; } }
	property float MostLow { float get(){ return mostLow; } }
	
	void ReqHistory(String ^frmWhen);
	void AddBar(Bar ^bar_info, bool move_stop);

	void CreateTrigger(float triggerPrice, float stopLossCents, int qSize, Side sd);
	
protected:
	void HistoryFromIB(System::Object^  sender, AxTWSLib::_DTwsEvents_historicalDataEvent^  e);
	void RealTimeFromIB(System::Object^  sender, AxTWSLib::_DTwsEvents_realtimeBarEvent^  e);
	int ibHistoryTicker;
	int ibRealTimeTicker;
	void MoveStopLoss();

	Account ^account;
	String ^symbolName;
	Trigger ^trigger;

	array<Bar^> ^bars;
	int cur_bar;

	float tmpBarHigh;
	float tmpBarLow;
	float tmpBarOpen;
	float mostHigh;
	float mostLow;
};
